import type { Rule } from "antd/es/form"
import dayjs from "dayjs"
import { v4 } from "uuid"

import { HOST_ID } from "~contents"

export const getStyleContainerRoot = () =>
  document
    .getElementById(HOST_ID)
    .shadowRoot.getElementById("plasmo-shadow-container")

export const defaultRule: Rule = {
  required: true,
  message: "Empty is not allowed"
}
export const getCurrentTimestamp = (time?: number | string) => {
  return time ? dayjs(time).valueOf() : dayjs().valueOf()
}
export const OIUUID = () => {
  return v4().toString()
}
